const APP = getApp()
APP.configLoadOK = () => {

}
Page({
  data: {
    markers: [],
    address: '',
    shopName: '',
    longitude: 0,
    latitude: 0,
    id: '',
    telephone: ''
  },
  onLoad: function (options) {
    console.log(options);
    this.setData({
      id: options.id,
      shopName: options.title,
      latitude: options.latitude,
      longitude: options.longitude,
      address: options.address,
      telephone: options.telephone
    })
    this.data.id = options.id
    this.shopSubdetail()
  },
shopSubdetail(res) {
    wx.setNavigationBarTitle({
      title: this.data.shopName,
    })
    const marker = {
      latitude: this.data.latitude,
      longitude: this.data.longitude,
      iconPath: wx.getStorageSync('mapPos'),
      height: 30,
      width: 30,
    }
    const markers = [marker]
    this.setData({
      markers
    })
  },
  // 联系我们
  phoneCall:function(){
    var phoneNumber = this.data.telephone
    wx.makePhoneCall({
      phoneNumber
    })
  },
  // 导航到店
  guideNow: function(){
    var name = this.data.shopName
    var address = this.data.address
    var latitude = Number(this.data.latitude) 
    var longitude = Number(this.data.longitude)
    wx.openLocation({
      name: name,
      address: address,
      latitude: latitude,
      longitude: longitude,
    })
  },
})